﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using Housing;

public partial class ManageCenter_ManageContinue : System.Web.UI.Page
{
    SubsidyRecord subsidy = new SubsidyRecord();
    ReduceRecord reduce = new ReduceRecord();
    KindRecord kind = new KindRecord();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request["id"] != null && Request["noid"] != null && Request["type"] != null)
        {
            int adjid = Convert.ToInt32(Request.QueryString["id"].ToString());
            if (Request.QueryString["type"].ToString() == "sub")
            {
                lbltype.Text = "租金补贴";
                lbltablename.Text = "SubsidyRecord";
                lblcolumnname.Text = "adj_subchecked";
                lbltimename.Text = "ind_subdate";
                subsidy.GetSubsidyRecordById(adjid);
                if (string.IsNullOrEmpty(subsidy.Adj_noid))
                {
                    lbllongtime.Text = subsidy.Adj_stoptime;
                    lbltime.Text = Convert.ToDateTime(subsidy.Adj_stoptime).ToString("yyyy年MM月");
                    lblremark.Text = subsidy.Adj_remark;
                }
            }
            else if (Request.QueryString["type"].ToString() == "red")
            {
                lbltype.Text = "租金减免";
                lbltablename.Text = "ReduceRecord";
                lblcolumnname.Text = "adj_redchecked";
                lbltimename.Text = "ind_reddate";
                reduce.GetReduceRecordById(adjid);
                if (string.IsNullOrEmpty(reduce.Adj_noid))
                {
                    lbllongtime.Text = reduce.Adj_stoptime;
                    lbltime.Text = Convert.ToDateTime(reduce.Adj_stoptime).ToString("yyyy年MM月");
                    lblremark.Text = reduce.Adj_remark;
                }
            }
            else if (Request.QueryString["type"].ToString() == "kind")
            {
                lbltype.Text = "实物配租";
                lbltablename.Text = "KindRecord";
                lblcolumnname.Text = "adj_kindchecked";
                lbltimename.Text = "ind_kinddate";
                kind.GetKindRecordById(adjid);
                if (string.IsNullOrEmpty(kind.Adj_noid))
                {
                    lbllongtime.Text = kind.Adj_stoptime;
                    lbltime.Text = Convert.ToDateTime(kind.Adj_stoptime).ToString("yyyy年MM月");
                    lblremark.Text = kind.Adj_remark;
                }
            }
            else
                WebHelper.AlertAndClose("链接地址错误，请重新进入！");
        }
        else
            WebHelper.AlertAndClose("链接地址错误！");
    }
    protected void btnpass_Click(object sender, EventArgs e)
    {
        if (kind.SetContinuePass(Request.QueryString["noid"].ToString(), Request.QueryString["id"].ToString(), lbltablename.Text, lblcolumnname.Text, lbltimename.Text, lbllongtime.Text))
            WebHelper.AlertAndCloseThenRefreshLastPage("审核成功，请继续其他操作！");
        else
            WebHelper.AlertAndClose("操作失败，请重新进入");
    }
    protected void btnunpass_Click(object sender, EventArgs e)
    {
        if (kind.SetContinueUnpass(Request.QueryString["id"].ToString(), lbltablename.Text))
            WebHelper.AlertAndCloseThenRefreshLastPage("否决申请成功，请继续其他操作！");
        else
            WebHelper.AlertAndClose("操作失败，请重新进入");
    }
}
